package com.busfm.util;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;

import com.busfm.R;
import com.busfm.activity.AboutActivity;
import com.busfm.activity.FgtPwdActivity;
import com.busfm.activity.HomeActivity;
import com.busfm.activity.LoginActivity;
import com.busfm.activity.RegisterActivity;
import com.busfm.activity.SettingActivity;
import com.busfm.model.ChannelList;
import com.busfm.model.PlayList;
import com.busfm.service.PlayerService;

public class InstrumentUtil {

    public static void launchMediaService(Context context, PlayList playList, String action) {
        Intent intent = new Intent();
        intent.setClass(context, PlayerService.class);
        intent.setAction(action);
        context.startService(intent);
    }

    public static void launchLogon(Activity context) {
        Intent intent = new Intent();
        intent.setClass(context, LoginActivity.class);
        context.startActivityForResult(intent, Constants.LOGINREQUESTCODE);
    }

    public static void launchRegister(Activity context) {
        Intent intent = new Intent();
        intent.setClass(context, RegisterActivity.class);
        context.startActivity(intent);
    }

    public static void launchFgtPwd(Activity context) {
        Intent intent = new Intent();
        intent.setClass(context, FgtPwdActivity.class);
        context.startActivity(intent);
    }
    
    public static void launchSetting(Activity context) {
        Intent intent = new Intent();
        intent.setClass(context, SettingActivity.class); 
        context.startActivity(intent);
    }

    public static void launchHomeActity(Activity context, ChannelList channelList) {
        Intent intent = new Intent();
        intent.setClass(context, HomeActivity.class);
        intent.putExtra(Constants.EXTRA_KEY_CHANNELLIST_ENTITY, channelList);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(intent);
    }

    public static void launchNetWorkSetActivity(Activity context) {
        Intent mIntent = new Intent();
        ComponentName comp = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
        mIntent.setComponent(comp);
        mIntent.setAction("android.intent.action.VIEW");
        context.startActivityForResult(mIntent, 3);
    }
    
    public static void launchAboutActivity(Activity context){
        Intent intent = new Intent();
        intent.setClass(context, AboutActivity.class);
        context.startActivity(intent);
    }
}
